import React, { useState } from 'react'

export default function App() {
  const [arr, setArr] = useState(['a', 'b', 'c'])
  return (
    <div>
      <ul>
        {arr.map((item, index) => {
          return (
            <li key={index}>
              {item} <input type="text" />
            </li>
          )
        })}
      </ul>
      <button
        onClick={() => {
          const newArr = [...arr]
          newArr.unshift('d')
          setArr(newArr)
        }}
      >
        往数组中添加数据-unshift
      </button>
    </div>
  )
}
